/*
 * @Date: 2025-09-29 22:47:36
 * @LastEditors: 贾二小 erxiao.jia@outlook.com
 * @LastEditTime: 2025-10-01 17:55:17
 * @FilePath: /admin-vue/src/stores/useUserStore.ts
 */
import { defineStore } from 'pinia'

export const useUserStore = defineStore('useUserStore', () => {
  const info = ref<UserModel>()

  function setInfo(user: UserModel) {
    info.value = user
  }

  const getInfo = async () => {
    if (!info.value) {
      const user = await useAuth().user()
      info.value = user
    }
  }

  return {
    info,
    setInfo,
    getInfo,
  }
})
